package com.example.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//拦截器配置类
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //addPathPatterns为拦截途径，excludePathPatterns为放行路径
        registry.addInterceptor(new UserIntercetor())
                .addPathPatterns("/back/**")
                .excludePathPatterns("/back/login/login.html");
    }
}
